package com.enbatis.mybatisplugs.service.impl;

import com.enbatis.mybatisplugs.base.BaseServiceImpl;
import com.enbatis.mybatisplugs.commons.utils.IdWorker;
import com.enbatis.mybatisplugs.entity.User;
import com.enbatis.mybatisplugs.mapper.UserMapper;
import com.enbatis.mybatisplugs.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl extends BaseServiceImpl<UserMapper,User> implements UserService {





    @Override
    @Transactional
    public void insertMany() {
        List<User> userList=new ArrayList<>();
        for (int i=0;i<1000000;i++) {
            User user=new User();
            user.setId(IdWorker.getId());
            user.setName("王卫东"+i);
            user.setPassword("AAA"+i);
            userList.add(user);
        }
        saveBatch(userList);
    }


}
